// 两个栈实现一个队列
// 实现一个实例对象进行封装处理
function QueueForStack() {
	this.stackPush = []
    this.stackPop = []
}

QueueForStack.prototype.push = function(val) {
	while(this.stackPop.length) {
        this.stackPush.push(this.stackPop.pop())
  }
  this.stackPush.push(val)
}


QueueForStack.prototype.pop =function() {
    while(this.stackPush.length) {
         this.stackPop.push(this.stackPush.pop())
    }
    if(this.stackPop.length == 0) return false
    return this.stackPop.pop()
}

let temp = new QueueForStack()
temp.push(1)
temp.push(2)
temp.push(3)
temp.push(4)
console.log(temp.pop())